<template>
    <!-- <div ref="echartRef" :style="'width:'+{width}+'px,height:'+{height}+'px'" ></div> -->
    <div ref="echartRef" class="echart"></div>
 </template>
 
 <script setup>
 import * as echarts from 'echarts';
 import { ref , onMounted } from "vue";

 defineProps({
    width:Number,
    height:Number,
    
 })
 
 
 const echartRef = ref(null);
 

 var option = {
    tooltip: {
        trigger: 'axis',
        axisPointer: {
            lineStyle: {
                color: '#adb6bc'
            }
        }
    },
    grid: {
        left: '3%',
        right: '4%',
        bottom: '3%',
        containLabel: true
    },
    xAxis: [{
        type: 'category',
        boundaryGap: false,
        axisLine: {
            lineStyle: {
                color: '#adb6bc'
            }
        },
        data: ['周一', '周二', '周三', '周三', '周四', '周五', '周六', '周日']
    }],
    yAxis: [{
        type: 'value',
        name: '近七日',
        axisTick: {
            show: false
        },
        axisLine: {
            lineStyle: {
                color: '#adb6bc'
            }
        },
        axisLabel: {
            margin: 10,
            textStyle: {
                fontSize: 14
            }
        },
        splitLine: {
            lineStyle: {
                color: '#adb6bc'
            }
        }
    }],
    series: [{
        name: '来访',
        type: 'line',
        smooth: true,
        symbol: 'circle',
        symbolSize: 5,
        showSymbol: false,
        lineStyle: {
            normal: {
                width: 1
            }
        },
        areaStyle: {
            normal: {
                color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
                    offset: 0,
                    color: 'rgba(137, 189, 27, 0.3)'
                }, {
                    offset: 0.8,
                    color: 'rgba(137, 189, 27, 0)'
                }], false),
                shadowColor: 'rgba(0, 0, 0, 0.1)',
                shadowBlur: 10
            }
        },
        itemStyle: {
            normal: {
                color: 'rgb(137,189,27)',
                borderColor: 'rgba(137,189,2,0.27)',
                borderWidth: 12

            }
        },
        data: [220, 182, 191, 134, 150, 120, 110, 125]
    }, {
        name: '离开',
        type: 'line',
        smooth: true,
        symbol: 'circle',
        symbolSize: 5,
        showSymbol: false,
        lineStyle: {
            normal: {
                width: 1
            }
        },
        areaStyle: {
            normal: {
                color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
                    offset: 0,
                    color: 'rgba(0, 136, 212, 0.3)'
                }, {
                    offset: 0.8,
                    color: 'rgba(0, 136, 212, 0)'
                }], false),
                shadowColor: 'rgba(0, 0, 0, 0.1)',
                shadowBlur: 10
            }
        },
        itemStyle: {
            normal: {
                color: 'rgb(0,136,212)',
                borderColor: 'rgba(0,136,212,0.2)',
                borderWidth: 12

            }
        },
        data: [120, 110, 125, 145, 122, 165, 122, 220]
    }]
};
 
onMounted( () => {
     let echart = echarts.init(echartRef.value);
     echart.setOption(option);
 
 })
 
 </script>
 <style  scoped lang="less">
    .echart{
        width: 100%;
        height: 100%;
        overflow: hidden;
    }
 </style>